package com.tutu.commons.feign;

import com.tutu.commons.entity.User;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

/**
 * @Program: SpringCloudAlibaba
 * @Description: openfeign调用user服务的客户端
 * @Author: JK.TuTu
 * @ @Version: 1.0
 * @Create: 2022-12-03 22:36
 **/
@FeignClient(value = "userserver")  //value的值为调用的服务名称
public interface UserClient {

    @GetMapping("/user/{uid}")  //需要和调用方法的请求路径请求方法保持一致
    User findUserById(@PathVariable("uid") int uid);

    /**
     * 获取用户可以借阅的图书数量
     */
    @GetMapping("/user/getUserNum/{uid}")
    int getUserNum(@PathVariable("uid") int uid);

    /**
     * 实现用户借阅图书
     */
    @GetMapping("/user/userBorrow/{uid}")
    boolean userBorrow(@PathVariable("uid") int uid);
}
